package com.isnotlocus.gulimail.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.isnotlocus.gulimail.product.valid.AddGroup;
import com.isnotlocus.gulimail.product.valid.ListValue;
import com.isnotlocus.gulimail.product.valid.UpdateGroup;
import com.isnotlocus.gulimail.product.valid.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author IsnotLocus
 * @email sunlightcs@gmail.com
 * @date 2020-07-16 17:00:57
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@NotNull(message="修改必须ID进行修改",groups = {UpdateGroup.class,UpdateStatusGroup.class})
	@Null(message = "添加不能携带ID",groups = {AddGroup.class})
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message="品牌名必须不能为空",groups = {AddGroup.class,UpdateGroup.class}) //该注解不能为null，并且至少包含一个非空白字符。接收字符序列。
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "必须要添加图片地址",groups = {AddGroup.class})
	@URL(message = "logo必须是回一个合法的URL地址",groups = {AddGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	@NotBlank(message="介绍必须不能为空",groups = {AddGroup.class}) //该注解修饰的字段不能为null或"" 支持CharSequence Collection Map Array
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
    @ListValue(vals = {0,1},message = "所填的值必须是0或1的一个数",groups = {AddGroup.class,UpdateGroup.class, UpdateStatusGroup.class}) //自定义注解校验
	private Integer showStatus;
	/**
	 *
	 *
	 *
	 * 检索首字母
	 */
	@NotBlank(message = "检索首字母不能为空",groups = {AddGroup.class})
    @Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是一个A-Z的首字母",groups = {AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@Min(value = 0,message = "排序字段必须大于0",groups={AddGroup.class})
    @NotNull(message="请填入你排序字段",groups={AddGroup.class,UpdateGroup.class})
	private Integer sort;

}
